<% provide(:title, translated_attribute(post.title)) %>

<% add_decidim_meta_tags(
  title: translated_attribute(post.title),
  description: translated_attribute(post.body),
  url: post_url(post.id),
  resource: post) %>

<%
  edit_link(
    resource_locator(post).edit,
    :update,
    :blogpost,
    blogpost: post
  )
%>

<%= append_javascript_pack_tag "decidim_blogs" %>
<%= append_stylesheet_pack_tag "decidim_blogs" %>

<%= render layout: "layouts/decidim/shared/layout_center", locals: { columns: 8 } do %>

  <%= render partial: "schema_org_blog_posting_post" %>

  <section class="layout-main__section layout-main__heading">
    <div class="flex justify-center">
      <h1 class="title-decorator my-12"><%= translated_attribute post.title %></h1>
    </div>

    <% if post.photo.present? %>
      <div class="blog__image grow">
        <%= image_tag post.photo.big_url, alt: post.photo.description || post.photo.title || t("alt", scope: "decidim.application.photo") %>
      </div>
    <% end %>

    <div class="layout-author">
      <div class="relative flex items-center justify-center w-full">
        <div class="w-10/12 flex items-center gap-4">
          <%= cell "decidim/author", post_presenter.author, from: post, context_actions: [:date], layout: :compact %>
        </div>
        <%= render "decidim/shared/resource_actions", resource: post do %>
          <%= render "decidim/blogs/posts/menu_actions", post: post %>
        <% end %>
      </div>
    </div>
  </section>

  <section class="layout-main__section">
    <div class="editor-content">
      <%= decidim_sanitize_editor_admin translated_attribute post.body %>
    </div>

    <%= attachments_for post %>

    <%= render partial: "actions" %>
  </section>

  <section class="layout-main__section">
    <%= comments_for post %>
  </section>
<% end %>
